function sleep(ms) {
	var start = Date.now()
	while(Date.now() - start <= ms ) ; 
}


console.time('sleep1')
var total = 0 ;
for (var i = 0; i < 10; i++) {
	sleep(i * 200)
	total += i * 200
	console.log(i)
}
console.log("total = ", total)

console.timeEnd('sleep1')


function sleep2() {
	return new Promise((resolve, reject) => {
		// setTimeout()
	})
}